<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head">
	<base th:href="@{/}">
	<meta charset="utf-8">
	<title>新增</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="static/layui/css/layui.css" media="all" />
	<script type="text/javascript" src="static/layui/layui.all.js"></script>
	<script type="text/javascript" src="static/plugin/jquery/jquery-3.2.1.min.js"></script>
</head>
<body class="layui-fluid" th:fragment="body">
<div class="layui-row">
	<div class="layui-col-md12">
		<form class="layui-form" lay-filter="formDemo" id="form" action="" style="padding-top: 20px;">
			<div class="layui-form-item">
				<label class="layui-form-label">科目</label>
				<div class="layui-input-block">
					<input type="text" name="depName" id="depName" lay-verify="required"  placeholder="请输入科目" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">类别</label>
				<div class="layui-input-block">
					<select class="layui-select" name="partsType">
						<option value="A件">A件</option>
						<option value="C件">C件</option>
						<option value="D件">D件</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">良率上限</label>
				<div class="layui-input-block">
					<input type="number" min="0" name="confValueMax" required  lay-verify="required" placeholder="请输入标准值" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">良率下限</label>
				<div class="layui-input-block">
					<input type="number" min="0" name="confValue" required  lay-verify="required" placeholder="请输入标准值" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">描述</label>
				<div class="layui-input-block">
					<input type="text" name="remarks" required  lay-verify="required" placeholder="请输入描述" autocomplete="off" class="layui-input">
				</div>
			</div>
		</form>
	</div>
</div>
</body>
<script type="text/javascript" th:inline="javascript">

	layui.config({
		base: "static/layui/"
	}).extend({
		tableSelect: 'tableSelect'
	}).use(['form', 'layer', 'jquery', 'table', 'laydate', 'upload','tableSelect'], function () {

		let tableSelect = layui.tableSelect;
		let form = layui.form;

		form.render()

		tableSelect.render({
			elem: '#depName',
			checkedKey: 'depName',
			searchPlaceholder: '科目名称',
			searchKey: 'depName',
			table: {
				url: 'manage/sys_config/getMesDepList'
				,method: 'post'
				,page: false
				,cols: [
					[
						{ type: 'radio' },
						{ field: 'depName', title: '科目编码',hide:true,templet: function (data) {
								return data.strDepartmentName;
							} },
						{ field: 'lngDepartmentID', title: '科目编码' },
						{ field: 'strDepartmentName', title: '科目名称' },
					]
				]
			},
			done: function (elem, data) {
				var NEWJSONNAME = []
				layui.each(data.data, function (index, item) {
					NEWJSONNAME.push(item.strDepartmentName)
				})
				elem.val(NEWJSONNAME.join(","))
			}
		})

	})

	function getFormDataAndValidate(){
		var data = $('#form').serializeArray();
		var obj = new Object();
		$.each(data, function(index, e){
			obj[e.name] = e.value;
		})
		return [true,obj];
	}

</script>
</html>